package com.yida.wy.common.service.impl;

import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.yida.wy.common.service.IBasicService;
import org.springframework.stereotype.Service;

/**
 * * 自定义接口实现类（继承mybatis-flex框架）
 *
 * @author lqq
 * @date 2023-11-21
 */
@Service
public class BasicServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements IBasicService<T> {

    @Override
    public <T> Page<T> basicPageAs(Integer pageNum, Integer pageSize, QueryWrapper wrapper, Class<T> dto) {
        return getMapper().paginateAs(pageNum, pageSize, wrapper, dto);
    }

    @Override
    public Page<T> basicPage(Integer pageNum, Integer pageSize, QueryWrapper wrapper) {
        Page<T> c = getMapper().paginate(pageNum, pageSize, wrapper);
        return c;
    }
}
